<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>Vue</title>
    <!-- development version, includes helpful console warnings -->
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    <!-- production version, optimized for size and speed -->
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
</head>
<script>

</script>

<body>
    <div id="example-1">
        <button v-on:click="counter += 1">Add 1</button>
        <p>The button above has been clicked {{ counter }} times.</p>
    </div>

    <div id="example-2">
        <!-- `greet` is the name of a method defined below -->
        <button v-on:click="greet">Greet</button>
    </div>

    <div id="example-3">
        <button v-on:click="say('hi')">Say hi</button>
        <button v-on:click="say('what')">Say what</button>
    </div>

    <!-- the click event's propagation will be stopped -->
    <a v-on:click.stop="doThis"></a>
    <!-- the submit event will no longer reload the page -->
    <form v-on:submit.prevent="onSubmit"></form>
    <!-- modifiers can be chained -->
    <a v-on:click.stop.prevent="doThat"></a>
    <!-- just the modifier -->
    <form v-on:submit.prevent></form>
    <!-- use capture mode when adding the event listener -->
    <!-- i.e. an event targeting an inner element is handled 
        here before being handled by that element -->
    <div v-on:click.capture="doThis">...</div>
    <!-- only trigger handler if event.target is the element itself -->
    <!-- i.e. not from a child element -->
    <div v-on:click.self="doThat">...</div>

    <!-- the click event will be triggered at most once -->
    <a v-on:click.once="doThis"></a>

    <!-- the scroll event's default behavior (scrolling) will happen -->
    <!-- immediately, instead of waiting for `onScroll` to complete  -->
    <!-- in case it contains `event.preventDefault()`                -->
    <div v-on:scroll.passive="onScroll">...</div>

    <!-- only call `vm.submit()` when the `keyCode` is 13 -->
    <input v-on:keyup.13="submit">

    <!-- same as above -->
    <input v-on:keyup.enter="submit">
    <!-- also works for shorthand -->
    <input @keyup.enter="submit">


    <input @keyup.page-down="onPageDown">


    <!-- Alt + C -->
    <input @keyup.alt.67="clear">
    <!-- Ctrl + Click -->
    <div @click.ctrl="doSomething">Do something</div>

    <!-- this will fire even if Alt or Shift is also pressed -->
    <button @click.ctrl="onClick">A</button>
    <!-- this will only fire when Ctrl and no other keys are pressed -->
    <button @click.ctrl.exact="onCtrlClick">A</button>
    <!-- this will only fire when no system modifiers are pressed -->
    <button @click.exact="onClick">A</button>

    
    <script>
        var example1 = new Vue({
            el: '#example-1',
            data: {
                counter: 0
            }
        })

        var example2 = new Vue({
            el: '#example-2',
            data: {
                name: 'Vue.js'
            },
            // define methods under the `methods` object
            methods: {
                greet: function (event) {
                    // `this` inside methods points to the Vue instance
                    alert('Hello ' + this.name + '!')
                    // `event` is the native DOM event
                    if (event) {
                        alert(event.target.tagName)
                    }
                }
            }
        })
        // you can invoke methods in JavaScript too
        example2.greet() // => 'Hello Vue.js!'

        new Vue({
            el: '#example-3',
            methods: {
                say: function (message) {
                    alert(message)
                }
            }
        })
    </script>


</body>

</html>